<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Vue的其他指令2</title>
</head>
<style>
    [v-cloak] {
        display: none;
    }
</style>
<body>

    <div id="app">
        <!-- v-vloak可解决胡子闪现现象，需配合style一起使用 -->
        <h1 v-cloak>{{msg}}</h1>
    </div>


    <script>

        // 通过两个setTimeOut来模拟网络的延迟导致的【胡子闪现】现象
        setTimeout(() => {
            let scriptElt = document.createElement('script')
            scriptElt.src = 'https://cdn.jsdelivr.net/npm/vue@2/dist/vue.js'
            document.head.append(scriptElt)
        }, 3000)

        setTimeout(() => {
            const vm = new Vue({
                el: '#app',
                data: {
                    msg: 'Vue的其他指令2',
                }
            })
        }, 4000)


    </script>

</body>

</html>